﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CarShop.Domain.Entities;

namespace CarShop.Data.EntityFramework.Mappings
{
    internal class UserInfoConfiguration : EntityBaseConfiguration<UserInfo, int>
    {
        public UserInfoConfiguration()
        {
            //Properties
            this.Property(u => u.FirstName).IsOptional().HasMaxLength(50);
            this.Property(u => u.LastName).IsOptional().HasMaxLength(50);
            this.Property(u => u.DateOfBirth).IsOptional();
            this.Property(u => u.PassportNumber).IsOptional().HasMaxLength(10);
            this.Property(u => u.Ssn).IsOptional().HasMaxLength(10);
         
            //Relations
          //  HasRequired(u => u.User)..WithOptional(u => u.UserInfo);

            HasRequired(u => u.User).WithOptional(u => u.UserInfo);
        }
    }
}
